<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>移除点击事件</title>
    <style type="text/css">
        *{
            margin:0px;
            padding:0px;
        }
        body, button, input, select, textarea {
            font: 12px/16px Verdana, Helvetica, Arial, sans-serif;
        }
        p{
            width:603px;
            padding-top:3px;
            overflow:hidden;
        }
        #container {
            min-width:603px;
            min-height:767px;
        }
    </style>
    <script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=POOBZ-3JRWX-H6K4G-7BX4U-JGL6O-LOBR4"></script>
    <script>
        var init = function() {
            getLocation();
            var map = new qq.maps.Map(document.getElementById("container"),{
                center: new qq.maps.LatLng(39.916527,116.397128),
                zoom: 13
            });
            //绑定单击事件  传递事件函数名称
            var listener = qq.maps.event.addListener(map, 'click', function(event) {

                var parent_layer_index = parent.layer.getFrameIndex(window.name);//获取窗口索引
                alert('您点击的位置为: [' + event.latLng.getLat() + ', ' +
                    event.latLng.getLng() + ']');
                parent.set_lat_lng(event.latLng.getLng(),event.latLng.getLat());
                parent.layer.close(parent_layer_index);

            });
            //移除绑定事件
            window.removeEvent = function() {
                qq.maps.event.removeListener(listener);
            };
        }
        function getLocation(){
            //判断是否支持 获取本地位置
            if (navigator.geolocation)
            {
                navigator.geolocation.getCurrentPosition(showPosition);
            }
            else{x.innerHTML="浏览器不支持定位.";}
        }
        function showPosition(position)
        {
            var lat=position.coords.latitude;
            var lng=position.coords.longitude;
//调用地图命名空间中的转换接口   type的可选值为 1:GPS经纬度，2:搜狗经纬度，3:百度经纬度，4:mapbar经纬度，5:google经纬度，6:搜狗墨卡托
            qq.maps.convertor.translate(new qq.maps.LatLng(lat,lng), 1, function(res){
                //取出经纬度并且赋值
                latlng = res[0];

                var map = new qq.maps.Map(document.getElementById("container"),{
                    center:  latlng,
                    zoom: 13
                });
                //设置marker标记
                var marker = new qq.maps.Marker({
                    map : map,
                    position : latlng
                });
            });
        }
    </script>
</head>
<body onload="init()">
<div id="container"></div>

</body>
</html>
